﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class SiteEN_SiteSearch : xIx.Web.UI.PageBase
{
    public string Qt
    {
        get
        {
            object v = ViewState["Qt"];
            if (null != v)
            {
                return (string)v;
            }
            else
            {
                return default(string);
            }
        }
        set
        {
            ViewState["Qt"] = value;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack) { 
            Qt=Request["Q"];
            GridView1.DataBind();
        }
    }

    protected void LSA_OnLoadingData(object sender, xIx.Web.Portal.SEDataEventArg e)
    {
        if (null==Qt|| Qt.Length < 2) {
            Alert("Query text must be two words or more.");
            return;
        }

        using (xIx.Data.DbHelper dh = new xIx.Data.DbHelper())
        {
            string q = @"SELECT i.ID ,FixStr(i.Title,22,'…') Title,i.ContentTime ,g.Title GT  FROM sys_listItems i  inner join Sys_Groups g on i.Gid=G.id
where i.title like @QT or i.text like @QT Order by i.ContentTime";

            DataTable dt = dh.GetData(q,"QT","%"+Qt+"%");
            e.OutDataView = dt.DefaultView;
        }
    }
}
